// ClassicalWithUnionFindProj.cpp: 定义控制台应用程序的入口点。
//根据计算机视觉的二值图像分析的逐行标记算法编写

#include "stdafx.h"

#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include "Union_Find.h"

using namespace cv;
using namespace std;

/*int B[MaxRow][MaxCol] = {
	{1, 1, 0, 1, 1, 1, 0, 1},
	{1, 1, 0, 1, 0, 1, 0, 1},
	{1, 1, 1, 1, 0, 0, 0, 1},
	{0, 0, 0, 0, 0, 0, 0, 1},
	{1, 1, 1, 1, 0, 1, 0, 1},
	{0, 0, 0, 1, 0, 1, 0, 1},
	{1, 1, 0, 1, 0, 0, 0, 1},
	{1, 1, 0, 1, 0, 1, 1, 1} };*/

int main(int argc, char** argv)
{	
	/*Mat image;
	image = imread(argv[1], IMREAD_COLOR); // Read the file

	Mat gray_image
	cvtColor(image, gray_image, COLOR_BGR2GRAY);*/
	Mat C = (Mat_<double>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
	Mat bit_image = (Mat_<uchar>(8, 8) << 
		1, 1, 0, 1, 1, 1, 0, 1, 
		1, 1, 0, 1, 0, 1, 0, 1,
		1, 1, 1, 1, 0, 0, 0, 1,
		0, 0, 0, 0, 0, 0, 0, 1,
		1, 1, 1, 1, 0, 1, 0, 1,
		0, 0, 0, 1, 0, 1, 0, 1,
		1, 1, 0, 1, 0, 0, 0, 1,
		1, 1, 0, 1, 0, 1, 1, 1);
	cout << "bit_image = " << endl << " " << bit_image << endl << endl;

	Mat result_image = (Mat_<uchar>(8, 8));

	Union_Find uf;
	uf.classical_with_union_find(bit_image, result_image);
	cout << "result_image = " << endl << " " << result_image << endl << endl;
	printf("finished");
	//waitKey(0); // Wait for a keystroke in the window
	//char a[10];
	//scanf_s("%s", a);
    return 0;
}

